import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int k = scanner.nextInt();
        int x = scanner.nextInt();

        int[] array = new int[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextInt();
        }

        Solution solution = new Solution();
        solution.findXSum(array,k,x);
    }
}

class Solution {
    public int[] findXSum(int[] nums, int k, int x) {
        int n = nums.length - k + 1;
        int[] res = new int[n];

        for (int i = 0; i < n; i++) {
            int[][] arr = new int[51][2];
            int m = i + k -1;
            int count = 0;
            for(int j = i; j <= m; j++){
                count = nums[j] == 0 ? count + 1 : count;
                arr[nums[j]][0] = nums[j];
                arr[nums[j]][1]++;
            }
            Arrays.sort(arr, (int[] a, int[] b) -> a[1] < b[1] || (a[1]==b[1] && a[0] < b[0]) ? 1 : -1);
            count = Math.min(count,x);
            int sum = 0;
            for (int l = 0; l < arr.length && count > 0; m++) {
                if (arr[m][1] > 0) {
                    count--;
                    sum += (arr[m][0] * arr[l][1]);
                }
            }
            res[i] = sum;
        }

        return res;
    }
}
